package com.sfac.hqyj.springBoot.modules.common.entity;

import com.fasterxml.jackson.annotation.JsonFormat;

@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum ImageType {
    PROFILE_SMALL("profile_small", 10, 10, 20),
    PROFILE_MIDDLE("profile_middle", 100, 100, 100),
    PROFILE_BIG("profile_big", 220, 220, 200),
    ;

    public String name;
    public int maxHeight;
    public int maxWidth;
    public int maxSize;

    ImageType(String name, int maxHeight, int maxWidth, int maxSize) {
        this.name = name;
        this.maxHeight = maxHeight;
        this.maxWidth = maxWidth;
        this.maxSize = maxSize;
    }

    public static ImageType getImageTypeByName(String name) {
        for (ImageType imageType : ImageType.values()) {
            if (name.equals(imageType.name)) {
                return imageType;
            }
        }
        return null;
    }
}
